/*
	Copyright 2008 Daniel Winkler
	Email: danthemanwinkler@gmail.com
	Cell #: 512-657-2653
	
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
package danlib;

public class IVec2
{
	public int x;
	public int y;
	
	public IVec2(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	
	public IVec2()
	{
		x = 0;
		y = 0;
	}
	
	public boolean equals( IVec2 v )
	{
		return (v.x == x && v.y == y);
	}
	
	public IVec2( IVec2 v )
	{
		x = v.x;
		y = v.y;
	}
	
	public void set(IVec2 p)
	{
		x = p.x;
		y = p.y;
	}
	
	public IVec2 add(IVec2 p)
	{
		x += p.x;
		y += p.y;
		return this;
	}
	
	public IVec2 sub(IVec2 p)
	{
		x -= p.x;
		y -= p.y;
		return this;
	}
	
	public int dot( IVec2 v )
	{
		return x*v.x + y*v.y;
	}
	
	public IVec2 mul(int v)
	{
		x *= v;
		y *= v;
		return this;
	}
	
	public void div(int v)
	{
		x /= v;
		y /= v;
	}
	
	public String toString()
	{
		return "x: " + x + ", y: " + y;
	}

}